/*
 * @Author: DaQing Lu
 * @Date: 2020-02-12 16:57:20
 * @LastEditors  : DaQing Lu
 * @LastEditTime : 2020-02-15 13:00:44
 * @Description: file content
 */
import Types from '../actionTypes';
import {getOrderlibrary, getOrderDetais} from '../../api';


const GET_ORDER_LIBRARY = (page, page_size, search) => {
  return new Promise((resolve, reject) => {
    getOrderlibrary(page, page_size, search).then(res => {
      resolve({
        type: Types.GET_ORDER_LIBRARY,
        res
      });
    }).catch(err => {
      console.log(err);
    });
  });
};

const GET_UNPAR_SINGLE_DETAILS = async order_no => {
  return new Promise((resolve, reject) => {
    getOrderDetais(order_no).then(res => {
      console.log(res);
      resolve({
        type: Types.GET_UNPAR_SINGLE_DETAILS,
        data: res.order[0].goods
      });
    }).catch(err => {
      console.log(err);
    });
  });
};

export default {
  GET_ORDER_LIBRARY,
  GET_UNPAR_SINGLE_DETAILS
};
